package be.ac.ua.ecampus.uacmat.entity;

import java.sql.SQLException;
import java.util.Collection;
import java.util.Vector;

import be.ac.ua.ecampus.uacmat.QueryHandler;

public class Training extends Entity {

	private Collection<Program> fPrograms;
	
	public Training(String id, String description) {
		super("training", id, description);
		this.fPrograms = new Vector<Program>();
	}
	
	public Collection<Program> getPrograms() throws SQLException {
    	if (this.fPrograms.isEmpty()) {
    		QueryHandler queryHandler = new QueryHandler();
            this.fPrograms = queryHandler.getProgramsForTraining(this.fId);
    	}
    	return this.fPrograms;
    }
	
}
